﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        bool playerum;
        bool playerdois;

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (playerum == true && button1.Text == "")
            {


                button1.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button1.Enabled = false;

            }
            else
            {
                playerum = true;
                button1.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button1.Enabled = false;
            }
        }

        private void button9_Click(object sender, EventArgs e)
        {
            if (playerum == true && button9.Text == "")
            {


                button9.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button9.Enabled = false;

            }
            else
            {
                playerum = true;
                button9.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button9.Enabled = false;
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void button10_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (playerum == true && button2.Text == "")
            {
                button2.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button2.Enabled = false;

            }
            else
            {
                playerum = true;
                button2.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button2.Enabled = false;
            }

        }

        private void button7_Click(object sender, EventArgs e)
        {
            if (playerum == true && button7.Text == "")
            {
                
             
                button7.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button7.Enabled = false;

            }
            else
            {
                playerum = true;
                button7.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button7.Enabled = false;
            }
}

        private void button5_Click(object sender, EventArgs e)
        {
            if (playerum == true && button5.Text == "")
            {


                button5.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button5.Enabled = false;

            }
            else
            {
                playerum = true;
                button5.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button5.Enabled = false;
            }
        }

        private void button8_Click(object sender, EventArgs e)
        {
            if (playerum == true && button8.Text == "")
            {


                button8.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button8.Enabled = false;

            }
            else
            {
                playerum = true;
                button8.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button8.Enabled = false;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (playerum == true && button3.Text == "")
            {


                button3.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button3.Enabled = false;

            }
            else
            {
                playerum = true;
                button3.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button3.Enabled = false;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (playerum == true && button4.Text == "")
            {


                button4.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button4.Enabled = false;

            }
            else
            {
                playerum = true;
                button4.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button4.Enabled = false;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            if (playerum == true && button6.Text == "")
            {


                button6.Text = "X";
                this.playerdois = true;
                this.playerum = false;
                button6.Enabled = false;

            }
            else
            {
                playerum = true;
                button6.Text = "O";
                this.playerum = true;
                this.playerdois = false;
                button6.Enabled = false;
            }
        }

        private void button10_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {

                playerum = true;
                playerdois = false;
                textBox1.Enabled = false;
                textBox4.Enabled = false;
                button2.Enabled = true;
                button1.Enabled = true;
                button3.Enabled = true;
                button4.Enabled = true;
                button5.Enabled = true;
                button6.Enabled = true;
                button7.Enabled = true;
                button8.Enabled = true;
                button9.Enabled = true;

            }
        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {

        }

        private void button11_Click(object sender, EventArgs e)
        {
            
            
                button2.Enabled = false;
                button1.Enabled = false;
                button3.Enabled = false;
                button4.Enabled = false;
                button5.Enabled = false;
                button6.Enabled = false;
                button7.Enabled = false;
                button8.Enabled = false;
                button9.Enabled = false;
                textBox1.Enabled = true;
                textBox4.Enabled = true; 
        
        }
        
        
        
    }

   public class Ganhador
   {
       Ganhador() { }
          }
}
